package com.gopay.cron.service.cloud.gen.bean;

import com.gopay.cron.web.vo.CloudAccountStatementVO;
import com.gopay.cron.web.vo.CloudSplitRefundFileVO;

/** 
 * @ClassName: CloudSplitRefundFileInfo 
 * @Description: 分账退款类
 * @author liuxuyang
 * @date 2018年3月16日 上午9:09:16  
 */

public class CloudSplitRefundFileInfo {

	public static final String fileFtpName = "分账退款类";
	private static final String csvFtpFirstLine = "\"商户账户\",\"退款总笔数\",\"退款总金额\",\"退款总手续费\"";
	private static final String csvFtpSecondLine = "\"商户编号\",\"分账退款订单号\",\"分账退款金额\",\"收款退款订单号\",\"收款退款订单金额\",\"原支付订单号\",\"原交易金额\",\"分账交易时间\",\"分账完成时间\"";

	private StringBuilder csvFtpFirstLineContent = new StringBuilder();
	private StringBuilder csvFtpSecondLineContent = new StringBuilder();
	
	
	public void addFtpFirstSplitRefundFileLine(CloudAccountStatementVO vo) {
        addFtpFirstCsvFileLine(vo);
    }

    private void addFtpFirstCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpFirstLineContent.append("\"").append(vo.getGopayAcct()).append("\",")
                .append("\"").append(vo.getTotalCount()).append("\",")
                .append("\"").append(vo.getTotalTxnAmt()).append("\",")
                .append("\"").append(vo.getTotalFeeAmt()).append("\"")
                .append("\r\n");
    }
    
	public void addFtpSecondSplitRefundFileLine(CloudSplitRefundFileVO vo) {
        addFtpSecondCsvFileLine(vo);
    }

    private void addFtpSecondCsvFileLine(CloudSplitRefundFileVO vo) {
        csvFtpSecondLineContent.append("\"").append(vo.getMerCustId()).append("\",")
                .append("\"").append(vo.getSplitRefundOrderId()).append("\",")
                .append("\"").append(vo.getSplitRefundAmt()).append("\",")
                .append("\"").append(vo.getReFundOrderId()).append("\",")
                .append("\"").append(vo.getReFundAmt()).append("\",")
                .append("\"").append(vo.getOriMerOrderId()).append("\",")
                .append("\"").append(vo.getOriOrderAmt()).append("\",")
                .append("\"").append(vo.getSplitCreateTime()).append("\",")
                .append("\"").append(vo.getSplitFinishTime()).append("\",")
                .append("\r\n");
    }
    
    public String getFtpCsvContent() {
    	StringBuilder sb = new StringBuilder(csvFtpFirstLine);
        sb.append("\r\n").append(csvFtpFirstLineContent.toString());
        sb.append(csvFtpSecondLine);
        sb.append("\r\n").append(csvFtpSecondLineContent.toString());
        return sb.toString();
    }
}
